<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        table tr th,td{
            border: 1px solid black;
            text-align: center;
        }
        table{
            border: 1px;
            cell-padding:0;
            cell-spacing:0;
            width: 80%;
            margin-top: 20px;
        }
        table thead{
            background-color:#b3d7ff ;
        }
        a{
            cursor: pointer;
        }
        input{
             border-top: none;
             border-left: none;
             border-right: none;
             border-bottom: black solid 1px;
         }


    </style>
    <link rel="stylesheet" href="../css/pintuer.css">
    <link rel="stylesheet" href="../css/bootstrap.css">

    <script src="../js/jquery-3.4.1.min.js"></script>
    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap-table1.15.3.js"></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../js/bootstrap-min-4.3.1.js"></script>
    <script src="../js/pintuer.js"></script>
    <script src="../js/initMain.js"></script>
    <script type="text/javascript">
        function initTable(){
        // 查询信息范围为已做工序登记和工序交接登记的派工单
            $("#tableInfo").bootstrapTable({
                method:"post",
                contentType:"application/json",
                url:"/mManufacture/queryMManufacture.action",
                //设置交替行样式
                striped:true,
                //初始显示页数
                pageNum:1,
                //是否显示分页
                pagination:true,
                //设置是服务端分页还是客户端分页
                sidePagination:"server",
                //页大小
                pageSize:3,
                //分页列表
                pageList: [3,5,6,10],
                //上传到服务器的参数
                queryParams:function (data) {
                    return{
                        //计算页号，当前号
                        pageNum:(data.offset/data.limit)+1,
                        //计算页大小
                        pageSize: data.limit,
                    }
                },
                columns:[

                    {title:"生产派工单编号",field:"manufactureId",align:"center",formatter:function (value,row,index) {
                        return "<a href='#' onclick='queryMManufactureById("+JSON.stringify(row)+")'>"+value+"</a>";
                    }},
                    {title:"产品编号",field:"productId",align:"center"},
                    {title:"产品名称",field:"productName",align:"center"},
                    {title:"数量",field:"amount",align:"center"},
                    {title:"生产状态",field:"manufactureProcedureTag",align:"center",formatter:function(value,row,index) {
                        if(value=='S002-2'){
                            return "已完工";
                        }else if(value=='S002-1'){
                            return "生产中";
                        }

                    }},
                ]

            })
        }
        var productId;
        $(function () {
            initTable();
            //复核通过
            $("#cancel").click(function () {
                $("#tableInfo").bootstrapTable("refresh");
            })

        })
        var mManufactureObj;
        //点击生产派工单编号
        function queryMManufactureById(mManufacture) {
            // alert(mManufacture.id);
            mManufactureObj=mManufacture;
            $("#MProcedureTable").bootstrapTable('destroy');
            $("#MProcedureTable").bootstrapTable({
                method:"post",
                contentType:"application/json",
                url:"/mProcedure/queryMProcedureByPId",
                //设置交替行样式
                striped:true,
                //初始显示页数
                pageNum:1,
                //是否显示分页
                pagination:true,
                //设置是服务端分页还是客户端分页
                sidePagination:"server",
                //页大小
                pageSize:3,
                //分页列表
                pageList: [3,5,6,10],
                //上传到服务器的参数
                queryParams:function (data) {
                    return{
                        //计算页号，当前号
                        pageNum:(data.offset/data.limit)+1,
                        //计算页大小
                        pageSize: data.limit,

                        mManufactureId:mManufactureObj.id
                    }
                },

                columns:[

                    {title:"序号",field:"detailsNumber",align:"center"},
                    {title:"工序名称",field:"procedureName",align:"center"},
                    {title:"实际工时数(小时)",field:"realLabourHourAmount",align:"center"},
                    {title:"设计工时数(小时)",field:"labourHourAmount",align:"center"},
                    {title:"设计工时成本(元)",field:"subtotal",align:"center"},
                    {title:"实际工时成本",field:"realSubtotal",align:"center"},
                    {title:"设计物料成本",field:"moduleSubtotal",align:"center"},
                    {title:"实际物料成本",field:"realModuleSubtotal",align:"center"},

                    {title:"工序状态",field:"procedureTransferTag",align:"center",formatter:function (value,row,index) {
                            if(value=='G005-2'){
                                return "已完成";
                            }else if(value=='G005-1'){
                                return "执行中";
                            }else{
                                return "等待";
                            }
                        }}
                ],
                onLoadSuccess:function () {
                    $("#addModel").modal("show");
                    $("#manufactureId").text(mManufacture.manufactureId);
                    if(mManufacture.manufactureProcedureTag=="S002-2"){
                        $("#testedAmount").text(mManufacture.testedAmount);
                    }else{
                        $("#testedAmount").text("生产中");
                    }
                    $("#amount").text(mManufacture.amount);

                    $("#productName").text(mManufacture.productName);
                    $("#productId").text(mManufacture.productId);
                    $("#moduleCostPriceSum").text(mManufacture.moduleCostPriceSum);
                    $("#realModuleCostPriceSum").text(mManufacture.realModuleCostPriceSum);
                    $("#realLabourCostPriceSum").text(mManufacture.realLabourCostPriceSum);
                    $("#labourCostPriceSum").text(mManufacture.labourCostPriceSum);
                    $("#register").text(mManufacture.register);
                    $("#registerTime").text(mManufacture.registerTime);
                    $("#remark").text(mManufacture.remark);
                }
            })
        }


        function initMDesignModule() {
            $("#MDesignModuleTable").bootstrapTable({
                method:"post",
                contentType:"application/json",
                url:"/mProcedureModule/queryMProcedureModuleByPId",
                //设置交替行样式
                striped:true,
                //初始显示页数
                pageNum:1,
                //是否显示分页
                pagination:true,
                //设置是服务端分页还是客户端分页
                sidePagination:"server",
                //页大小
                pageSize:3,
                //分页列表
                pageList: [3,5,6,10],
                //上传到服务器的参数
                queryParams:function (data) {
                    return{
                        //计算页号，当前号
                        pageNum:(data.offset/data.limit)+1,
                        //计算页大小
                        pageSize: data.limit,

                        pId:mProcedureId
                    }
                },

                columns:[

                    {title:"ID",field:"id",hidden:true,align:"center",formatter:function (value,row,index) {
                            return "<span class='MDesignModuleId'>"+value+"</span>"
                        }},
                    {title:"序号",field:"detailsNumber",align:"center"},
                    {title:"物料名称",field:"productName",align:"center",formatter:function (value,row,index) {
                            return "<span class='productName'>"+value+"</span>"
                        }},
                    {title:"物料编号",field:"productId",align:"center",formatter:function (value,row,index) {
                            return "<span class='productId'>"+value+"</span>"
                        }},
                    {title:"单位物料成本",field:"costPrice",align:"center",formatter:function (value,row,index) {
                            return "<span class='costPrice'>"+value+"</span>"
                        }},
                    {title:"设计数量",field:"amount",align:"center"},
                    {title:"补充数量",field:"renewAmount",align:"center"},
                    {title:"已使用数量",field:"realAmount",align:"center"},
                    {title:"本次数量",field:"realAmount",align:"center"}
                ]
            })
        }
        function initMProcedureTable() {


        }
    </script>
</head>
<body>
    <div>

        <table id="tableInfo">

        </table>
    </div>
    <div class="modal  fade" id="addModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 90%">
            <div class="modal-content" style="border: 1px solid black;">
                <div class="modal-header">
                    <div class="container">
                        <div class="row">
                            <div class="col-7" style="text-align: right">
                                <h5 class="modal-title" id="info" >
                                    生产派工单
                                </h5>
                            </div>
                            <div class="col-3"></div>
                            <div class="col-2" style="position: absolute;right: 30px"></div>
                        </div>
                    </div>
                    <button type="button" id="cancel" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right: 0px">

                    </button>
                </div>
                <div class="modal-body">
                    <form id="addProcedureForm">
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-2" style="text-align: right">
                                    <span>派工单编号：</span>
                                </div>
                                <div class="col-4">
                                    <span id="manufactureId"></span><br>
                                </div>
                                <!--<div class="col-2" style="text-align:right">
                                    数量：
                                </div>
                                <div class="col-4">
                                    <span id="amount"></span>
                                </div>-->

                            </div><br>
                            <div class="row">
                                <div class="col-2" style="text-align:right">
                                    产品名称：
                                </div>
                                <div class="col-4">
                                    <span id="productName">笔记本</span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    产品编号：
                                </div>
                                <div class="col-4">
                                    <span id="productId" >20001002192001</span>
                                </div>
                            </div>
                            <div class="row" style="margin-top: 30px;">
                                <div class="col-2" style="text-align:right">
                                    投产数量：
                                </div>
                                <div class="col-4">
                                    <span id="amount"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    合格数量：
                                </div>
                                <div class="col-4">
                                    <span id="testedAmount"></span>
                                </div>

                            </div>
                        </div><br>



                        <div class="container">
                            <div class="row">
                                <div class="col-2" style="text-align:right">
                                    设计物料总成本：
                                </div>
                                <div class="col-4">
                                    <span id="moduleCostPriceSum"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    设计工时总成本：
                                </div>
                                <div class="col-4">
                                    <span id="labourCostPriceSum"></span>
                                </div>
                            </div>
                        </div><br>
                        <div class="container">
                            <div class="row">


                                <div class="col-2" style="text-align:right">
                                    实际物料总成本：
                                </div>
                                <div class="col-4">
                                    <span id="realModuleCostPriceSum"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    实际工时总成本：
                                </div>
                                <div class="col-4">
                                    <span id="realLabourCostPriceSum"></span>
                                </div>
                            </div>
                        </div><br>


                        <table id="MProcedureTable"  style="margin-left: 20px">

                        </table><br>

                        <div class="container">
                            <div class="row">
                                <div class="col-2" style="text-align:right">
                                    登记人：
                                </div>
                                <div class="col-4">
                                    <span name="register" id="register"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    登记时间：
                                </div>
                                <div class="col-4">
                                    <span  name="registerTime" id="registerTime"></span>
                                </div>
                            </div>
                        </div><br>
                        <br>
                        <span style="margin-left: 55px">备注：</span>
                        <span style="width: 550px;margin-left: 150px"  id="remark">

                        </span>

                    </form>
                </div>

            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>


<!--    设计工序物料-->
    <div class="modal  fade" id="addDesignModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 90%;">
            <div class="modal-content" style="border: 1px solid black;">
                <div class="modal-header">
                    <div class="container">
                        <div class="row">
                            <div class="col-7" style="text-align: right"></div>
                            <div class="col-3"></div>
                            <div class="col-2" style="position: absolute;right: 30px">
                                <button class="btn btn-primary"  id="saveCheckProceduring" >通过</button>
                            </div>
                        </div>
                    </div>
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right: 0px"></button>
                </div>
                <div style="width: 80%;height: 550px;border: 2px solid gray;margin: 0 auto;margin-top: 10px">
                    <h3 align="center" style="margin-top: 30px">生产登记单</h3>
                    <div class="container-fluid">
                        <form id="putRegister">
                            <div class="row" style="margin-top: 30px;">
                                <div class="col-2" style="text-align:right">
                                    派工单编号：
                                </div>
                                <div class="col-4">
                                    <span id="manufactureId1"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    工序名称：
                                </div>
                                <div class="col-4">
                                    <span id="procedureName"></span>
                                </div>

                            </div>
                            <div class="row" style="margin-top: 30px;">
                                <div class="col-2" style="text-align:right">
                                    负责人：
                                </div>
                                <div class="col-4">
                                    <input id="procedureResponsiblePerson"/>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    设计工时数：
                                </div>
                                <div class="col-4">
                                    <span id="labourHourAmount"></span>
                                </div>

                            </div>
                            <div class="row" style="margin-top: 30px;">
                                <div class="col-2" style="text-align:right">
                                    已用工时数：
                                </div>
                                <div class="col-4">
                                    <span id="userdLabourHourAmount"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    本次工时数：
                                </div>
                                <div class="col-4">
                                    <span id="realLabourHourAmount" ></span>
                                </div>

                            </div><br/>

                            <div>
                                <table id="MDesignModuleTable" width="80%" style="margin-top: 20px;" class="table table-sm">

                                </table>
                            </div>
                            <div class="row" style="margin-top: 30px;">
                                <div class="col-2" style="text-align:right">
                                    复核人：
                                </div>
                                <div class="col-4">
                                    <span id="checker1"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    复核时间：
                                </div>
                                <div class="col-4">
                                    <span id="checkTime1"></span>
                                </div>

                            </div>


                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>

    <div class="modal  fade" id="transferProcedure" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 90%;">
            <div class="modal-content" style="border: 1px solid black;">
                <div class="modal-header">
                    <div class="container">
                        <div class="row">
                            <div class="col-7" style="text-align: right"></div>
                            <div class="col-3"></div>
                            <div class="col-2" style="position: absolute;right: 30px">
                                <button class="btn btn-primary"  id="saveCheckTransferProceduring" >通过</button>
                            </div>
                        </div>
                    </div>
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right: 0px"></button>
                </div>
                <div style="width: 70%;height: 350px;border: 2px solid gray;margin: 0 auto;margin-top: 10px">
                    <h3 align="center" style="margin-top: 30px">交接登记复核</h3><hr>
                    <div class="container-fluid">
                            <div class="row" style="margin-top: 30px;">
                                <div class="col-2" style="text-align:right">
                                    工序编号：
                                </div>
                                <div class="col-4">
                                    <span id="procedureId1"></span>
                                </div>
                                <div class="col-2" style="text-align:right">
                                    工序名称：
                                </div>
                                <div class="col-4">
                                    <span id="procedureName1"></span>
                                </div>

                            </div>


                    </div>
                </div>
                <div style="height: 300px">

                </div>

            </div>
        </div>
    </div>
</body>

</html>